String Comparison Funny...

I am in the process of doing some string comparisons, and have a head scratcher...

First of all, I have a string "3.1". Its length is 4....huh?

  • Why am I getting length of 4 (expect 3)?

I also am retrieving a data item from a skip list of similar string, to do a comparison. The skip list data item also is of length 4...yet when I perform a coparision, it fails.

Here we go:
var 1 = "3.1", var2 = "3.1"...both length 4

print(var1 == var2), result = FALSE. They are both the same...why isn't the compare working?

Thx! GK
gkane - Wed Nov 10 17:20:32 EST 2010

Re: String Comparison Funny...
gkane - Thu Nov 11 09:51:09 EST 2010

Fixed...

With the use of numerous 'print' statements (pain in the $&!)...I found there to be too many characters included in my string extraction.

Comparison is working.

My kingdom for a DXL debugger...this text editor stuff is lame!

Come on IBM....

GK

Re: String Comparison Funny...
SystemAdmin - Thu Nov 18 07:31:13 EST 2010

There is a debug feature in the DXL editor from Sodius with breakpoints, step by step, and variable inspection.

www.dxleditor.com

Re: String Comparison Funny...
gkane - Thu Nov 18 08:54:27 EST 2010

SystemAdmin - Thu Nov 18 07:31:13 EST 2010
There is a debug feature in the DXL editor from Sodius with breakpoints, step by step, and variable inspection.

www.dxleditor.com

Yes...Sodius has put together what looks to be an awesome product for DXL editing.

Unfortunately, to get all the bells and whistles, it takes $$$. I currently work for a company whose IT budget is pretty much frozen...getting the DXL Pro version (two grand!)...not gonna happen.

I will at least get the free editor, that will provide a much better editing experience than the text editor.

I am really surprised at the lack of innovation on IBMs part relative to DXL editing and tools...pretty poor!

Thanks for the reply...have a great day!

GK

Re: String Comparison Funny...
llandale - Thu Nov 18 13:20:30 EST 2010

gkane - Thu Nov 11 09:51:09 EST 2010
Fixed...

With the use of numerous 'print' statements (pain in the $&!)...I found there to be too many characters included in my string extraction.

Comparison is working.

My kingdom for a DXL debugger...this text editor stuff is lame!

Come on IBM....

GK

Ok, so its likely I'm a century behind the times here, but I don't see how a clever debugger is easier than inserting this print statment, which will let you see its really 4 characters:

print ">>MyFunctionName, Extract is: " (length(Extract)) "\t\n"

But you don't need that. Length is 4, display is 3, there surely is some extra character in there introduced when it was extracted.

Clever debuggers have a strong place for compiled-linked-loaded-deployed code for which you cannot easily install debug code or it takes a long time for each such test. The time from DXL edit to DXL run is just a handfull of seconds, not dozens of minutes like for complex high level language systems. Been there done that (for FORTRAN and Assembly).

I assure you I've got far more complex DXL than you can imagine (got 15,000 lines under development right now) and have no difficulty debugging with print statements. Generally, any 'clever' function gets its own print statments showing input and output, and when I see it's working just comment it out. Now if you do wierd address of addresses or complicated recursive algorthims stuff, the print statements then get awkward; but then so would a debugger.

  • Louie

Re: String Comparison Funny...
gkane - Thu Nov 18 14:11:14 EST 2010

llandale - Thu Nov 18 13:20:30 EST 2010
Ok, so its likely I'm a century behind the times here, but I don't see how a clever debugger is easier than inserting this print statment, which will let you see its really 4 characters:

print ">>MyFunctionName, Extract is: " (length(Extract)) "\t\n"

But you don't need that. Length is 4, display is 3, there surely is some extra character in there introduced when it was extracted.

Clever debuggers have a strong place for compiled-linked-loaded-deployed code for which you cannot easily install debug code or it takes a long time for each such test. The time from DXL edit to DXL run is just a handfull of seconds, not dozens of minutes like for complex high level language systems. Been there done that (for FORTRAN and Assembly).

I assure you I've got far more complex DXL than you can imagine (got 15,000 lines under development right now) and have no difficulty debugging with print statements. Generally, any 'clever' function gets its own print statments showing input and output, and when I see it's working just comment it out. Now if you do wierd address of addresses or complicated recursive algorthims stuff, the print statements then get awkward; but then so would a debugger.

  • Louie

@llandale
Thanks for the reply...yes I was able to notice the extra character through 'print' debugging.

And yes, with all due respect, you are only a 'couple of decades' behind the times when it comes to debugging. I guess I am just so used to 'seeing' realtime the data I am manipulating. But you do the best you can with what you got :)

Oh, and as far as your 15,000 lines of DXL code....let me guess...you work for the government :E Just kidding!

Thanks again, you've been a big help!

GK